#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
void swap_in_bsort(size_t width, const void* elem1, const void* elem2)
{
	size_t i = 0;
	char tmp = 0;
	for (i = 0; i < width; i++)
	{
		char tmp = *((char*)elem1 + i);
		*((char*)elem1 + i) = *((char*)elem2 + i);
		*((char*)elem2 + i) = tmp;
	}
}

void bsort(void* base, size_t num, size_t width, int(*cmp)(const void* elem1, const void* elem2))
{
	size_t i = 0;
	size_t j = 0;
	for (i = 0; i < num - 1; i++)
	{
		for (j = 0; j < num - i - 1; j++)
		{
			if (cmp((char*)base + j * width, (char*)base + (j + 1) * width) > 0)
			{
				swap_in_bsort(width, (char*)base + j * width, (char*)base + (j + 1) * width);
			}
		}
	}
}